#region License Revision: 0 Last Revised: 6/18/2008 11:00 AM
/******************************************************************************
Copyright (c) Microsoft Corporation.  All rights reserved.


This file is licensed under the Microsoft Public License (Ms-PL). A copy of the Ms-PL should accompany this file. 
If it does not, you can obtain a copy from: 

http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
******************************************************************************/
#endregion // License
using System;
using System.Windows.Browser;
using System.Diagnostics;
using ScriptInterop;

namespace VIEWS // Virtual Earth Wrapper
{

/// <summary>Contains the information about a specific bird's eye image.</summary>
public class VEBirdseyeScene : JSObject 
{
	/// <summary>String holding JavaScript class name</summary>
	private static string thisClass = "VEBirdseyeScene";
	
	/// <summary>Get the JavaScript class name</summary>
	/// <returns type="String">The class name used in JavaScript </returns>		
	public override string ClassName
	{
		get { return thisClass; }
	}

	/// <summary>Construct a C# wrapper from a ScriptObject</summary>
	public VEBirdseyeScene(ScriptObject so) : base(so) { }

	/// <summary>Construct a C# wrapper and a new Javascript object</summary>
	public VEBirdseyeScene()
	{ScriptObject = CreateClass();}

	/// <summary>Determines whether the location specified by a VELatLong Class object is within the current VEBirdseyeScene object.</summary>
	/// <param name="Latlong" type="VELatLong">A VELatLong Class object. Required.</param>
	/// <returns type="Boolean">A Boolean value. True if the location specified by the VELatLong object is within the bounds of the VEBirdseyeScene object.</returns>		
	public bool ContainsLatLong(VELatLong latLong)
	{
		return Invoke<bool>("ContainsLatLong", (ScriptObject)latLong);
	}

	/// <summary>Determines whether a specified pixel is within the current VEBirdseyeScene object.</summary>
	/// <param name="x" type="Number">The X component of the pixel. Required.</param>
	/// <param name="y" type="Number">The Y component of the pixel. Required.</param>
	/// <param name="zoomLevel" type="Number">The current zoom level of the map.</param>
	/// <returns type="Boolean">A Boolean value. True if the specified pixel is within the bounds of the VEBirdseyeScene object.</returns>		
	public bool ContainsPixel(int x, int y, int zoomLevel)
	{
		return Invoke<bool>("ContainsPixel", x, y, zoomLevel);
	}
	
    /// <summary>Gets an unencrypted and rounded off bounding rectangle for the VEBirdseyeScene object.</summary>
    /// <value>A VELatLongRectangle Class object containing the bounding rectangle.</value>		
    public VELatLongRectangle BoundingRectangle
	{
		get
        {
            object obj = Invoke("GetBoundingRectangle");
            if (obj == null)
                return null;
            ScriptObject so = (ScriptObject)obj;
            var ret = new VELatLongRectangle(so);
            return ret;
        }
	}
	
    /// <summary>Gets the height of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution.</summary>
    /// <value>The height in pixels.</value>		
    public int Height
	{
        get { return Invoke<int>("GetHeight"); }
	}
	
    /// <summary>Gets the identity of the current VEBirdseyeScene object.</summary>
    /// <value>The scene identity as an integer.</value>
    public int Id
	{
        get { return Invoke<int>("GetID"); }
	}


	/// <summary>Gets the orientation (VEOrientation Enumeration) of the current VEBirdseyeScene object.</summary>
    /// <value>The orientation (VEOrientation Enumeration) of the current VEBirdseyeScene object.</value>
	public VEOrientation Orientation
	{
        get { return ScriptEnumConverter.ToOrientation(Invoke<string>("GetOrientation")); }
	}

    /// <summary>Gets the file name of the thumbnail image associated with the current VEBirdseyeScene object.</summary>
    /// <value>The URL of the thumbnail image.</value>		
    public string ThumbnailFileName
	{
        get { return Invoke<string>("GetThumbnailFilename"); }
	}

    /// <summary>Gets the width of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution.</summary>
    /// <value>The width in pixels.</value>		
    public int Width
	{
        get { return Invoke<int>("GetWidth"); }
	}

	/// <summary>Converts a VELatLong Class object (latitude/longitude pair) to the corresponding pixel on the map.</summary>
	/// <param name="LatLong" type="VELatLong">A VELatLong Class object, which contains the latitude and longitude of a point. This method also accepts an encrypted VELatLong object, as supplied by the VEBirdseyeScene.PixelToLatLong Method.</param>
	/// <param name="zoomLevel" type="Number">The zoom level of the current map view</param>		
	/// <returns type="VEPixel">A pixel location of the VELatLong Class point. This object has two properties, x and y.</returns>		
	public VEPixel LatLongToPixel(VELatLong latLong, int zoomLevel)
	{
		ScriptObject so = Invoke<ScriptObject>("LatLongToPixel", (ScriptObject)latLong, zoomLevel);
		var ret = new VEPixel(so);
		return ret;
	}

	/// <summary>Converts a point in the bird's eye scene to an encrypted latitude/longitude value.</summary>
	/// <param name="pixel" type="VEPixel">A VEPixel Class object representing a pixel location on the map</param>
	/// <param name="zoomLevel" type="Number">The zoom level of the current map view</param>		
	/// <returns type="String">A String value that represents an encrypted VELatLong object.</returns>		
	public string PixelToLatLong(VEPixel pixel, int zoomLevel)
	{
		return Invoke<string>("PixelToLatLong", (ScriptObject)pixel, zoomLevel);
	}   
}

}
